package com.yunhe.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
 * 投票取值实体类
 * */
@Entity
@Table(name="vote_item")
public class Item {
	//编号
		@Id
		@SequenceGenerator(name="SEQ_VOTE_ITEM",sequenceName="SEQ_VOTE_ITEM",allocationSize=1)
		@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SEQ_VOTE_ITEM")
		@Column(name="vi_id")
	private Integer vi_id;
	//投票选项
		@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.REMOVE},fetch = FetchType.EAGER)
		@JoinColumn(name="vo_id")
	private Option option;
	//投票内容
		@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.REMOVE},fetch = FetchType.EAGER)
		@JoinColumn(name="vs_id")
	private Subject subject;
	//用户
		@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.REMOVE},fetch = FetchType.EAGER)
		@JoinColumn(name="vu_user_id")
	private User user;
		public Integer getVi_id() {
			return vi_id;
		}
		public void setVi_id(Integer vi_id) {
			this.vi_id = vi_id;
		}
		public Option getOption() {
			return option;
		}
		public void setOption(Option option) {
			this.option = option;
		}
		public Subject getSubject() {
			return subject;
		}
		public void setSubject(Subject subject) {
			this.subject = subject;
		}
		public User getUser() {
			return user;
		}
		public void setUser(User user) {
			this.user = user;
		}
	
}
